package demo1;

import java.util.*;


public class Solution {
    /**
     * 代码中的类名、方法名、参数名已经指定，请勿修改，直接返回方法规定的值即可
     *
     * 
     * @param S string字符串 
     * @param T string字符串 
     * @return bool布尔型
     */
    public boolean isSubsequence (String S, String T) {
        if (S == null ||T == null) {
            return false;
        }
        StringBuilder sb = new StringBuilder();
        for (int i = 0, j = 0; j < T.length() && i < S.length(); j++) {
            if (S.charAt(i) == T.charAt(j)) {
                sb.append(S.charAt(i)+"");
                i++;
            }
        }
        if (sb.length() == S.length()) {
            return true;
        }
        return false;
    }
}